from commonerror import PlayError

class Play:
    """ Contains info about a mastergoal play, which can have at most 
    four moves """
    
    playcount = 0
    
    def __init__(self):
        self.movelist = []
        Play.playcount+=1
        
    def add_move(self, move):
        if len(self.movelist) > 3:
            raise PlayError("play can have at most 4 moves")
        self.movelist.append(move)
        
    def __len__(self):
        return len(self.movelist)